Imaging device and focus adjustment method

ABSTRACT

An imaging device, comprising an image sensor having image pixels and phase difference pixels, a phase difference detection section that detects a phase difference based on pixel data of the phase difference pixels, a pixel data calculation section that calculates pixel data of virtual imaging pixels at positions of the phase difference pixels, a degree of coincidence calculation section that calculates a degree of coincidence between each pixel data of the virtual imaging pixels that has been calculated, a reliability determination section that determines reliability of the phase difference detection result in accordance with the degree of coincidence, and a focus adjustment section that performs focus adjustment based on the phase difference detection result and the reliability.

CROSS-REFERENCE TO RELATED APPLICATIONS

Benefit is claimed, under 35 U.S.C. § 119, to the filing date of priorJapanese Patent Application No. 2019-047987 filed on Mar. 15, 2019. Thisapplication is expressly incorporated herein by reference. The scope ofthe present invention is not limited to any requirements of the specificembodiments described in the application.

BACKGROUND OF THE INVENTION 1. Field of the Invention

The present invention relates to an imaging device that is provided withan image sensor having phase difference pixels for phase differencedetection arranged on an image plane, and to a focus adjustment methodof this imaging device.

2. Description of the Related Art

Conventionally, focus adjustment of a photographing lens has beenperformed using phase difference AF (Auto Focus). With phase differenceAF, light flux that has passed through a pair of pupil regions of aphotographing lens is subjected to photoelectric conversion byrespective photoelectric conversion element rows, phase differencebetween two photoelectric conversion signals output from thephotoelectric conversion element rows is calculated, and focusadjustment of the photographing lens is performed based on this phasedifference.

There are various proposals regarding phase difference AF. For example,in Japanese patent laid-open No. 2014-222268 (hereafter referred to as“patent publication 1”) it is proposed to arranged phase differencepixels on an image plane of an image sensor, and determine reliabilityof detections results using image plane phase difference detection.Also, in Japanese patent laid-open No. 2000-101880 (hereafter referredto as “patent publication 2”) a structure is disclosed wherein phasedifference detection light flux is imaged at a peripheral part of animage sensor by mean of an AF optical system, phase difference isdetected based on this phase difference detection light flux, and at thetime of shooting the AF optical system is retracted. With this imagingdevice, pixel data from a peripheral part on an image sensor where phasedifference detection light flux is imaged is subjected to interpolationwith respect to peripheral pixel data, to generate an image for display.Also, in Japanese patent laid open number 2007-282108 (hereafterreferred to as “patent publication 3”), since it is not possible toacquire pixel data for imaging at phase difference pixels positions, ithas been proposed, to estimate output of virtual image pixels for phasedifference pixel positions, and ensure shooting image quality.

In patent publication 1 described above, determining reliability ofimage plane phase difference detection is disclosed. However, in a casewhere a subject is a high frequency pattern, it is likely thatreliability will become high for any subject for which false focus islikely. This means that erroneous detection results will be adopted, andfocus will be not be achieved. Also, in patent publications 2 and 3described above it is disclosed that virtual image pixel output forpositions of phase difference pixels is estimated in order to ensureimage quality of taken images. However, there is no descriptionregarding using output of virtual image pixels for positions of thesephase difference pixels in AF. There is also no description whatsoeverregarding solving lowering of AF precision for a subject of a highfrequency pattern. In particular, in a case where arrangement positionsof paired phase difference pixels of the image sensor are separated withrespect to a subject of a high-frequency pattern, ranging variationsoccur, and there is a possibility of erroneous ranging.

SUMMARY OF THE INVENTION

The present invention provides an imaging device and a focus adjustmentmethod of high ranging precision, when performing AF detection, even fora troublesome subject, such as a high-frequency pattern.

An imaging device of a first aspect of the present invention comprisesan image sensor having image pixels that receive light of a subjectimage though a photographing lens and perform photoelectric conversion,and paired phase difference pixels that respectively receive light fluxcorresponding to pupil regions that are paired with the photographinglens and perform photoelectric conversion on the light flux that hasbeen received, and a processor having a phase difference detectionsection, pixel data calculation section, degree of coincidencecalculation section, reliability determination section, and focusadjustment section, wherein the phase difference detection sectiondetects a phase difference based on pixel data of the paired phasedifference pixels, the pixel data calculation section calculates pixeldata of virtual image pixels at positions of the phase differencepixels, or selects pixel data of image pixels around positions of thephase difference pixels, the degree of coincidence calculation sectioncalculates degree of coincidence between each pixel data of the virtualimage pixels that have been calculated, or calculates degree ofcoincidence of each pixel data of image pixels that have been selectedfor positions of paired phase difference pixels, the reliabilitydetermination section determines reliability of the phase differencedetection result in accordance with the degree of coincidence, and thefocus adjustment section performs focus adjustment based on the phasedifference detection result and the reliability.

A focus adjustment method of a second aspect of the present invention isa focus adjustment method for an imaging device provided with an imagesensor having image pixels that receive light of a subject image thougha photographing lens and perform photoelectric conversion, and pairedphase difference pixels that respectively receive light fluxcorresponding to paired pupil regions for the photographing lens andperform photoelectric conversion on the light flux that has beenreceived, the focus adjustment method comprising detecting a phasedifference based on pixel data of the paired phase difference pixels,calculating pixel data of virtual image pixels at positions of the phasedifference pixels, or selecting pixel data of image pixels aroundpositions of the phase difference pixels, calculating degree ofcoincidence between each pixel data of the virtual image pixels thathave been calculated, or calculating degree of coincidence of each pixeldata of image pixels that have been selected for positions of pairedphase difference pixels, determining reliability of the phase differencedetection result in accordance with the degree of coincidence, andperforming focus adjustment based on the phase difference detectionresult and the reliability.

A non-transitory computer-readable medium of a third aspect of thepresent invention, storing a processor executable code, which whenexecuted by at least one processor, the processor being provided withinan imaging device provided with an image sensor having image pixels thatreceive light of a subject image though a photographing lens and performphotoelectric conversion, and paired phase difference pixels thatrespectively receive light flux corresponding to pupil regions that arepaired with the photographing lens and perform photoelectric conversionon the light flux that has been received, performs a focus adjustingmethod, the focus adjusting method comprising detecting a phasedifference based on pixel data of the paired phase difference pixels,calculating pixel data of virtual image pixels at positions of the phasedifference pixels, or selecting pixel data of image pixels aroundpositions of the phase difference pixels, calculating degree ofcoincidence between each pixel data of the virtual image pixels thathave been calculated, or calculating degree of coincidence of each pixeldata of image pixels that have been selected for positions of pairedphase difference pixels, determining reliability of the phase differencedetection result in accordance with the degree of coincidence, andperforming focus adjustment based on the phase difference detectionresult and the reliability.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram mainly showing the electrical structure of animaging device of one embodiment of the present invention.

FIG. 2A and FIG. 2B are plan diagrams showing arrangement of pixels ofan image sensor of an imaging device of one embodiment of the presentinvention.

FIG. 3 is a graph showing an R pixel characteristic, L pixelcharacteristic, and normal pixel characteristic, in the imaging deviceof one embodiment of the present invention.

FIG. 4A and FIG. 4B are drawings showing examples of high frequencypatterns that have been imaged on an image sensor, in the imaging deviceof one embodiment of the present invention.

FIG. 5 is a flowchart showing ranging operation, in the imaging deviceof one embodiment of the present invention.

FIG. 6 is a flowchart showing reliability determination operation, inthe imaging device of one embodiment of the present invention.

FIG. 7 is a plan diagram showing a modified example of arrangement ofpixels of an image sensor of an imaging device of one embodiment of thepresent invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

An example where the present invention has been applied to a digitalcamera will be described in the following as an imaging device of oneembodiment of the present invention. This digital camera has an imagingsection, with a subject image being converted to image data by thisimaging section, and the subject image being subjected to live viewdisplay on a display section arranged on the rear surface of the camerabody based on this image data that has been converted. A photographerdetermines composition and photo opportunity by looking at the live viewdisplay. At the time of a release operation image data is stored in astorage medium. Image data that has been stored in the storage mediumcan be subjected to playback display on the display section if playbackmode is selected.

Also, the imaging device of this embodiment calculates virtual output ofnormal pixels equivalent to pixel output of image pixels correspondingto positions of pairs of phase difference pixels (refer to S5 in FIG.5), and obtains degree of coincidence for associated normal pixelvirtual output corresponding to positions of pairs of phase differencepixels (refer to S7 in FIG. 5). The imaging device then employs phasedifference detection that has used output of those pairs of phasedifference pixels in a case where degree of coincidence that has beenobtained is high, and phase difference detection is performed byremoving output of those pairs of phase difference pixels in a casewhere degree of coincidence is low (refer to S29 and S31 in FIG. 6).

FIG. 1 is a block diagram mainly showing the electrical structure of animaging device 1 of this embodiment. The imaging device 1 of thisembodiment is a so-called compact camera, and has a lens barrel and acamera body formed integrally. However, this is not limiting, and theimaging device may be an interchangeable lens type camera with which aninterchangeable lens can be fitted to and removed from the camera body,such as a single-lens camera.

A photographing lens 2 forms a subject image on an image sensor 4. Thephotographing lens 2 has a focus lens and a zoom lens etc., and theselenses are capable of movement in an optical axis direction of thephotographing lens 2. A lens drive section 16 for moving the focus lensof the photographing lens 2 is arranged. The lens drive section 16 has alens drive mechanism and lens drive circuit, and the lens drive section16 moves the focus lens and performs focus adjustment based on controlsignals from a system controller 30.

Also, an aperture may be arranged on the optical axis of thephotographing lens 2, and in this case an aperture drive mechanism andaperture drive circuit for changing the opening diameter of the apertureare arranged. Further, a shutter may be arranged on the optical axis ofthe photographing lens 2, between the photographing lens 2 and the imagesensor 4. In this case, a shutter drive mechanism and a shutter drivecircuit are arranged. Exposure control may be performed by adjustingaperture, shutter, sensitivity of the image sensor 4 etc., and may alsobe performed using any one or two of these three parameters, or byadding an ND filter etc.

The image sensor 4 is arranged close to a position where a subject imageis formed by the photographing lens 2. The image sensor 4 is, forexample, a CCD (Charge Coupled Device) or CMOS (ComplementaryMetal-Oxide-Semiconductor) image sensor etc. The image sensor 4 has apixel section with image pixels and phase difference pixels arrangedtwo-dimensionally. Image pixels are normal pixels, and subject a subjectimage that has been formed by the photographing lens 2 to photoelectricconversion using photodiodes, and generate a photoelectric conversionsignal. An image signal is output based on this photoelectric conversionsignal, and subjected to image processing for live view display and forimage storage. It should be noted that a contrast value (focusevaluation value) is also calculated using the image signal, and focusadjustment of the photographing lens may be performed using thiscontrast value and a defocus amount based on the phase differencepixels. It should be noted that the image sensor 4 may have colorfilters of a Bayer array, as one example.

Also, phase difference pixels respectively subject light flux that haspassed through different regions of the photographing lens 2 tophotoelectric conversion using photodiodes, and generate a photoelectricconversion signal. Specifically, the phase difference pixels receiveonly light flux, of the light flux that has passed through thephotographing lens, from a specified direction (pupil region) of eitherof a right direction and a left direction (or upper direction and lowerdirection etc.), and generate a photoelectric conversion signal. Adefocus amount for the photographing lens is calculated by obtaining aphase difference of photoelectric conversion signals based on a pair oflight fluxes from one direction and the other direction. Arrangement ofphase difference pixels will be described later using FIG. 2A and FIG.2B, and output of the phase difference pixels will be described laterusing FIG. 3.

The image sensor 4 functions as an image sensor having image pixels thatreceive light of a subject image though a photographing lens and performphotoelectric conversion, and paired phase difference pixels thatrespectively receive light flux corresponding to pupil regions that arepaired with the photographing lens and perform photoelectric conversionon the light flux that has been received. As will be described later,the image sensor 4 also has color filters for each pixel.

An image sensor IF (interface) circuit 6 performs photoelectricconversion signal accumulation and readout operations for the imagesensor 4. The image sensor IF circuit 6 executes imaging control of theimage sensor 4 based on control signals from the system controller 30,and outputs a photoelectric conversion signal that has been readout tothe system controller 30. It should be noted that the image sensor IFcircuit 6 may also output to the system controller 30 after thephotoelectric conversion signal has been subjected to AD conversion.

A clock circuit 8 has a clock function and a calendar function, andoutputs clocked results and calendar information to the systemcontroller 30.

A memory card 10 is a storage medium that can be loaded into the body ofthe imaging device 1, and is an electrically rewritable non-volatilememory. Image data that has been acquired from the image sensor 4 andsubjected to image processing for storage is stored in the memory card10.

DRAM (Dynamic Random Access Memory) 12 is an electrically rewritablevolatile memory. Various data used by the system controller 30 istemporarily stored in the DRAM 12. It should be noted that an SDRAM(synchronous dynamic random access memory) may also be provided fortemporary storage of image data.

Flash ROM 14 is an electrically rewritable non-volatile memory. Controlprograms 14 a and control parameters 14 b are stored in the flash ROM14. Control programs 14 a are used when performing overall control ofthe imaging device 1 using the CPU 30 a. Control parameters 14 b areparameters for various circuits and mechanisms, used when performingcontrol of the imaging device 1.

A battery 20 is a power supply battery for performing supply of power tothe imaging device 1. A power circuit 22 makes a power supply voltage ofthe battery 20 into a specified constant voltage, and supplies power toeach section within the imaging device 1. A monitor 26 is a monitor thathas been arranged on an outer casing of the body of the imaging device,and/or a monitor such as an electronic viewfinder that is viewed bymeans of an eyepiece. Various images, such as live view images that havebeen acquired by the image sensor 4, playback images of images that havebeen stored in the memory card 10, menu images etc. are displayed on themonitor 26. A monitor drive circuit 24 is a circuit for displayingvarious images that have been output from the system controller 30 onthe monitor 26.

An operation section 28 is an input interface for a user to issuevarious instructions to the imaging device 1. The operation section 28has various operation members such as a release button, mode dial orswitch, touch panel etc., detects operating states and outputs detectionresults to the system controller 30.

The system controller 30 is a processor that includes a CPU (CentralProcessing Unit) 30 a and peripheral circuits of the CPU. The CPU 30 acontrols each section within the imaging device 1 in accordance withcontrol programs 14 a that have been stored in the flash ROM 14. Thesystem controller 30 or the CPU 30 a function as a processor having aphase difference detection section, pixel data calculation section,degree of coincidence calculation section, reliability determinationsection, and focus adjustment section. It should be noted that in thisembodiment, although each of the sections described above areimplemented within the system controller 30, the system controller 30may be a single processor, or may be configured using a plurality ofprocessors.

The previously described reliability determination section determinesreliability of phase difference detection in accordance with degree ofcoincidence. The reliability determination section determines thatreliability is low if degree of coincidence is lower than a thresholdvalue. Also, the reliability determination section determines thatreliability is higher as degree of coincidence is higher. Thereliability determination section determines reliability for everyranging area.

Also, as was described previously, the system controller 30 or the CPU30 a function as a processor having a focus adjustment section thatperforms focus adjustment based on phase difference detection resultsand reliability. The focus controller determines a ranging area forcalculating defocus amount of the photographing lens by excludingranging results for ranging areas of low reliability based on thereliability that has been determined for each ranging area (refer to S39in FIG. 6). The system controller 30 functions as a processor having apixel data selection section for selecting pixel data of image pixels,around positions of phase difference pixels.

An image processing circuit 30 b generates image data from an imagesignal that has been readout from the image sensor 4, and appliesvarious image processing, such as exposure correction and noiseprocessing, WB gain correction, demosaicing processing, edgeenhancement, false color correction etc. to this image data that hasbeen generated or image data that has been saved in DRAM 12. The imageprocessing circuit 30 b also performs processing (developmentprocessing) to convert image data that has been subjected to the abovedescribed image processing to a stored data format.

Also, the image processing circuit 30 b calculates virtual image pixeldata for positions where phase difference pixels are arranged.Specifically, a mask member (light shielding member) for receiving onlylight flux passing through the photographing lens 2 from either one of apair of pupil regions is arranged on the phase difference pixels. Sincesome of the light flux from the photographing lens 2 is shielded usingthis mask member, the phase difference pixel data cannot be used as isas image pixel data. The image processing circuit 30 b (pixel datacalculating circuit) therefore generates virtual image pixel data forphase difference pixel positions using computational processing such asinterpolation computation using image pixels that have been arrangedaround the phase difference pixels. The image processing circuit 30 bfunctions as a pixel data calculation section that calculates pixel dataof virtual image pixels at positions of the phase difference pixels, orselects pixel data of image pixels around positions of the phasedifference pixels.

The image processing circuit 30 b functions as an pixel data calculationsection that has a gain setting circuit (gain setting section) that setsgain for pixel data of phase difference pixels, and an interpolationcircuit (interpolation section) that interpolates pixel data of virtualimage pixels corresponding to positions of phase difference pixels basedon pixel data of image pixels positioned around the phase differencepixels, and that calculates pixel data of virtual image pixelscorresponding to positions of phase difference pixels, based on valuesresulting from subjecting pixel data of phase difference pixels to thegain, and pixel data that has been interpolated.

A phase difference detection circuit 30 c detects phase difference fromoutput signals of phase difference pixels that have been provided on theimage sensor 4, and calculates defocus amount. As was describedpreviously, the phase difference pixels receive only light flux, of thelight flux that has passed through the photographing lens, from aspecified direction of either of a right direction and a left direction(or upper direction and lower direction etc.), and signals are outputbased on light flux from one direction and the other direction. Thephase difference detection circuit 30 c calculates phase difference oftwo paired signals using these signals. Various computation methods havebeen proposed for computing phase difference, and phase difference maybeobtained by computation such as is disclosed in Japanese patentlaid-open No. 2016-015634 and Japanese patent laid-open No. 2016-080791,for example. With this embodiment, a degree of similarity S(i) isobtained using equation (1), which will be described later, and i wherethis degree of similarity S(i) becomes a minimum value is equivalent todefocus amount. Calculation of phase differences performed for everyranging area.

The phase difference detection circuit 30 c functions as a phasedifference detection section that detects phase difference based onpixel data of paired phase difference pixels. The phase differencedetection section detects phase difference by excluding pixel data ofphase difference pixels for which it has been determined thatreliability is low. The phase difference detection section detects phasedifference for every ranging area.

Also, the phase difference detection circuit 30 c performs degree ofcoincidence computation using equation (1) which will be describedlater, using virtual image pixel data for phase difference pixelpositions that has been calculated by the image processing circuit 30 b.This degree of coincidence computation is the same as the phasedifference computation, in terms of computation format. The meaning ofdegree of coincidence computation will be described later, but degree ofcoincidence computation results are used in determination as to whetheror not there is a troublesome subject, when performing phase differenceAF detection. The phase difference detection circuit 30 c may also be adegree of coincidence circuit, and functions as a degree of coincidencecalculation section that calculates degree of coincidence for each pixeldata of virtual image pixels that has been calculated for positions ofpaired phase difference pixels, or calculates degree of coincidence ofeach pixel data of the image pixels that have been selected forpositions of paired phase difference pixels.

The degree of coincidence calculation section calculates degree ofcoincidence for every ranging area. Also, the phase difference detectioncircuit 30 c functions as a degree of coincidence calculation sectionthat calculates degree of coincidence for associated pixel data of imagepixels that have been selected. The degree of coincidence calculationsection calculates degree of coincidence based on pixel data of imagepixels that have the same color filter. The degree of coincidencecalculation section calculates degree of coincidence of associated pixeldata of image pixels having color filters of different colors, and thereliability determination section determines reliability based on aplurality of degrees of coincidence corresponding to different colors(refer to FIG. 7 which will be described later). Also, the degree ofcoincidence calculation section calculates degree of coincidence ofassociated pixel data of a plurality of image pixels having a colorfilter of the same color, and the reliability determination sectiondetermines reliability based on a plurality of degrees of coincidencefor each of a plurality of color filters of the same color (refer toFIG. 7 which will be described later).

An external memory interface (IF) circuit 30 d is an interface circuitwhen writing image data etc. to the memory card 10, and reading imagedata etc. from the memory card 10. An A/D converter 30 e convertsvarious analog signals, such as analog signals that have been outputfrom the image sensor IF circuit 6, to digital data.

Next, arrangement of phase difference pixels and image pixels of theimage sensor 4 will be described using FIG. 2A and FIG. 2B. Colorfilters are arranged for each pixel, in front of the phase differencepixels and image pixels of the image sensor 4. In FIG. 2A, pixelsdenoted “R” and “L” are phase difference pixels. R pixels are pixelsthat receive only light flux from a right side direction, of the lightflux that has passed through the photographing lens. Also, L pixels arepixels that receive only light flux from a left side direction, of thelight flux that has passed through the photographing lens. Pixels thatare not denoted “R” or “L” are normal image pixels, and red pixelshaving a red filter arranged in front, green pixels having a greenfilter arranged in front, and blue pixels having a blue filter arrangedin front, are arranged as shown in FIG. 2A. R pixels and L pixels arearranged at positions of green pixels having a regular color filterarrangement pattern. R pixels and L pixels have green filters arrangedin front.

In FIG. 2A, R pixel 4R1 and L pixel 4L1 constitute a pair, and R pixel4R2 and left pixel 4L2 constitute a pair, and there is a four-pixelseparation (interval of three-pixels) between these R pixels and Lpixels. Within the vertical direction grid lines S1, S2, S3 . . .addition values of associated R pixels and addition values of associatedL pixels are obtained, and computation for phase difference detection isperformed using these addition values (refer to equation (1) which willbe described later).

FIG. 2B shows appearance of having converted phase difference pixel dataof positions of R pixels and L pixels to image pixel data usinginterpolation. Specifically, phase difference pixel data of R pixels andL pixels has values resulting from having subjected light flux fromeither one direction within light flux that has passed though thephotographing lens to photoelectric conversion, as was describedpreviously. This means that if phase difference pixel data is used as isfor a live view image or stored image, there will be degradation inimage quality. Values of virtual image pixels for position of the phasedifference pixels are therefore obtained by the image processing circuit30 b by interpolation computation, using image pixels around positionsof the phase difference pixels. The virtual image pixels (data) areshown as “G” pixels.

As was described previously, phase difference pixels (R pixels, Lpixels) are arranged at positions of green pixels. In FIG. 2B, values of“G” pixels are calculated by interpolation computation of values of Rpixels or L pixels using imaging pixel data of green pixels respectivelysurrounding the R pixels or L pixels. Using this interpolationcomputation it is possible to acquire image pixel data for the whole ofthe image sensor 4, including positions of phase difference pixels, andit is possible to acquire high quality image data. Also, the phasedifference detection circuit 30 c performs degree of coincidencecomputation using virtual image pixel data for positions of G pixels (S7in FIG. 5). The CPU 30 a performs reliability determination based onresults of this computation (S9 in FIG. 5).

Next, optical characteristics of the phase difference pixels and imagepixels will be described using FIG. 3. The horizontal axis of FIG. 3shows angle of light flux that is incident on the phase differencepixels and image pixels (normal pixels), and the vertical axis showsexposure sensitivity that has been standardized. As shown in FIG. 3,with the R pixels characteristic exposure sensitivity tends towards apeak of sensitivity at the right side, and with the L pixelscharacteristic tends towards a peak of sensitivity at the left side.Contrary to this, with the image pixels characteristic a peak ofsensitivity is close to an incident angle of 0 degrees, and thesensitivity characteristic is line symmetrical with close to 0° as acenter.

In obtaining a phase difference, correlation calculation is performed inranging computation preprocessing. Specifically, correlation values arecalculated using a known method, using pixel addition values for everyranging area, from images corresponding to right openings (standardsignal) and left openings (reference signal). In order to cut down oncomputation amount, the correlation calculation uses a method ofscanning a reference signal with a standard signal, and computing adegree of similarity for each position on the reference signal, forexample, detecting position where a correlation computational valuebecomes minimum and degree of similarity is maximum. By making onestandard signal B(i) and making the other reference signal R(i), degreeof similarity S(i) can be calculated from equation (1) below. arepresents correlation calculation range. It can be considered that ascanning position where degree of similarity S(i) becomes a minimumvalue is where correlation between the standard signal and the referencesignal will be highest. Correlation calculation is performed for everyranging area.

$\begin{matrix}{{S(i)} = {\sum\limits_{K = {{- \alpha}/2}}^{\alpha/2}{{{B\left( {i + K} \right)} - {R(K)}}}}} & (1)\end{matrix}$

In equation (1) above, the closer value for degree of similarity S(i) isto 0, the less the difference between standard signal B(i) and referencesignal R(i), which means that there is no difference between imageswithin the ranging area. On the other hand, since normal image pixelsare all open, an incident characteristic becomes line symmetrical aboutthe origin (0°), as shown in FIG. 3. This means that if correlationcalculation of equation (1) is performed using a pair of associatedimage pixel data, it will result in a fixed value regardless of theangle of incidence. Accordingly, a case where correlation calculationusing image pixel data is performed and there is a change in thiscomputation value means there is difference in image data, not indefocus amount.

As was described using FIG. 2A, generally a pair of phase differencepixels (R pixels L pixels) are arranged with distance between them. Ifthe R pixels and L pixels are close, then it will become difficult tocalculate pixel data for normal image pixels corresponding to positionsof phase difference pixels by interpolation computation such as wasdescribed using FIG. 2B. Phase difference pixels constituting a pair aretherefore arranged a distance apart to a certain extent.

Since pairs of phase difference pixels are arranged apart, if parts ofimages, such as a pixel size level high-frequency subject orperiodicity-containing subject, such as shown in FIG. 4A and FIG. 4B,become overlaid on phase difference pixels, then cases will arise whereit is not possible to calculate correct correlation values, even ifcorrelation calculation is performed using pixel data of phasedifference pixels. For example, as shown in FIG. 4A, a case is assumedwhere for pixel B(i) that outputs a standard signal an image for a highluminance portion of a high frequency subject is projected, while forpixel R(i) that outputs a reference signal an image for a low-luminancepart of a high frequency subject is half projected. In this case, sincethe pixel B(i) and the pixel R(i) are looking at different subjects, itwill not be possible to calculate a correct correlation value, even ifcorrelation calculation is performed. Similarly, as shown in FIG. 4B, alow luminance portion of an image is being projected onto pixel B(i)that outputs a standard signal, and a high luminance portion of an imageis being projected onto pixel R(i) that outputs a reference signal. Inthis type of case also, it will not be possible to calculate the correctcorrelation value even if correlation calculation is performed.

It should be noted that a subject having a high frequency pattern, aninclined pattern, or a periodic pattern means, for example, design andpattern of clothing, and design and pattern of walls, ceilings andfloors of buildings etc. when shooting a general subject. Also, whenobserving/shooting cells using a microscope, for example, an image of asample such as a collection of many cells could be a high frequencypattern or periodic pattern. Also, when observing/shooting organs etc.within the human body using a medical endoscope, there may be ahigh-frequency pattern, inclined pattern, or periodic pattern in a casewhere there are many fine blood vessels, such as blood capillaries.

In cases such as shown in FIG. 4A and FIG. 4B, if the correlationcalculation of equation (1) is performed using virtual image pixel data,a correlation calculation value (degree of coincidence) would become anextremely high value far from 0. Accordingly, in a case where incidentlight of the image pixels is affected by a high frequency subject etc.,in other words in a case where a correlation calculation value that hasbeen calculated using virtual image pixel data exceeds a fixed thresholdvalue, it can be said that incident light of the phase difference pixelswill also be affected by a high frequency subject etc. Therefore, forranging areas in which a correlation calculation value, that has beencalculated using virtual image pixel data that was calculated forpositions of phase difference pixels, has exceeded a specified thresholdvalue, it is possible to obtain a defocus amount using high reliabilitydata, by excluding ranging data of these regions.

In this way, with this embodiment, in the case of a general subject,which is not a subject for which AF detection is difficult, such as asubject having a subject pattern that is a high frequency pattern or asubject having a subject pattern that is a periodic pattern, ifcorrelation calculation is performed using pixel data of L pixels and Rpixels, image shift amount changes in accordance with focus adjustmentstate of the focus lens. On the other hand, since pixel data of imagepixels (for example green pixels in FIG. 2B) does not havecharacteristic change in image shift amount like the L pixels and Rpixels (refer to FIG. 3), image shift amount does not change inaccordance with defocus of the focus lens. This means that ifcorrelation calculation (degree of coincidence computation) is performedfor associated image pixel data, a correlation calculation value willbecome a value having an extremely high degree of coincidence and closeto 0, regardless of defocus amount.

Conditions under which degree of coincidence of image pixel data becomeslow are cases where data changes at a pixel size level, and when imagedata of a high frequency subject before and after a Nyquist frequencyetc. exists in subject pixel region. Understandably, in a case wherepixel data of normal image pixels is affected and a correlationcalculation value changes, pixel data of phase difference pixels is alsoaffected. Accordingly, in a case where a correlation calculation value(degree of coincidence computation value) of virtual image pixel data (Gpixel data) moves away from 0 which represents coincidence, and islarger than a specified threshold value due to the effect of anundesirable subject, it is possible to calculate defocus amount usingphase difference data of high reliability by excluding phase differencedata of that ranging area. In this way, the degree of coincidencecomputation value represents a high degree of coincidence as thenumerical value becomes small, and a low degree of coincidence as thenumerical value becomes large.

It should be noted that image pixel data that is the subject ofcorrelation calculation (degree of coincidence computation) is madevirtual image pixel data (pixel data of G pixels) after having beencorrected using interpolation processing etc. (refer to S5 and S7 inFIG. 5, which will be described later). Since they are at the samepositions and intervals, it is possible to determine reliability ofdetections results for defocus amount using phase difference pixels, bycalculating degree of coincidence for associated virtual image pixel (Gpixel) data.

Next, a ranging operation of this embodiment will be described using theflowcharts shown in FIG. 5 and FIG. 6. These flowcharts are implementedby the CPU 30 a controlling each section within the imaging device 1based on control programs 14 a stored within the flash ROM 14.

If the ranging operation shown in FIG. 5 is commenced, first stillreadout data is acquired (S1). Here, an accumulation operation for stillreadout is executed by the image sensor 4, and then the image sensor IFcircuit 6 reads out still readout pixel data from the image sensor 4 andstores in memory (DRAM). Still readout pixel data is pixel data that hasbeen read out from the phase difference pixels and image pixels of theimage sensor.

Once readout of still readout data (pixel data) has been performed,next, AF calculation is performed using still readout data (S3). Here,the image processing circuit 30 b extracts phase difference pixel datafrom still readout data that was read out and stored in step S1. If thephase difference pixel data has been extracted, the phase differencedetection circuit 30 c performs correlation calculation such as shown inequation (1), for example, calculates pixel offset amount (scanningposition) where correlation calculation value becomes a minimum value,and obtains defocus amount. In this case, correlation calculation isperformed for every ranging area, and defocus amount is calculated.

Also, if still readout data has been acquired in step S1, then afterimage processing on phase difference pixel data, Bayer data (image datacorresponding to a Bayer array) is generated (S5). Here, for phasedifference pixel data at positions of the R pixels and L pixels shown inFIG. 2A, the image processing circuit 30 b performs interpolationcomputation using surrounding image pixel data, and calculates imagepixel data at positions of the G pixels shown in FIG. 2B to generateBayer data. Specifically, the image processing circuit 30 b calculatespixel data for virtual image pixels at positions of the phase differencepixels (R pixels, L pixels).

If Bayer data has been generated, next, degree of coincidencecomputation is performed using the Bayer data (S7). Here, the phasedifference detection circuit 30 c calculates degree of coincidence byperforming correlation calculation such as shown in equation (1), forexample. Calculation of degree of coincidence may be with equation (1)and may be with other than equation (1). It should be noted thatprocessing in steps S5 and S7 may also be performed in parallel withstep S3. Also, processing of steps S5 and S7 may be performed afterexecution of the processing of step S3, or before execution of theprocessing of step S3.

Once the computation of steps S3 or S7 has been performed, next,reliability determination is performed (S9). Here, reliability isdetermined for every ranging area based on results of computing degreeof coincidence in step S7. In this case, if degree of coincidencecomputation value is greater than a specified value it is determinedthat reliability of that ranging area is low, and ranging result of aranging area having low reliability is excluded. Detailed processing ofthis reliability determination will be described later using FIG. 6.

If reliability determination has been performed, next, a ranging area isdetermined (S11). Here, the CPU 30 a determines a ranging area used infocus adjustment based on reliability determination results of step S9.Once ranging area has been determined, this flow is terminated, andfocus adjustment of the focus lens is performed using a known method.

Next, the reliability determination of step S9 will be described usingthe flowchart shown in FIG. 6. If the reliability determination flowcommences operation, first, AF computation results using still read-outdata are referenced (S21). Here AF computation results that werecalculated using phase difference pixel data included in the stillread-out data in step S3 are referenced.

Next, it is determined whether or not there are a plurality of validdata that can be used in AF computation results (S23). In step S3, whenthe phase difference detection circuit 30 c performs AF computation forevery ranging area, there are cases where ranging result is not obtaineddue to the fact that contrast of the subject is low or there is aperiodicity-containing subject. In this step the CPU 30 a determineswhether or not there are a plurality of ranging areas for which rangingresult was obtained using AF computation.

If the result of determination in step S23 is that there are a pluralityof valid data that can be used in AF computation results, a degree ofcoincidence computation value derived from Bayer data is referenced(S25). Here, the CPU 30 a references a computation result (degree ofcoincidence computation value) for degree of coincidence computation forBayer data that was performed by the phase difference detection circuit30 c in step S7.

If the degree of coincidence computation result for Bayer data has beenreferenced, next, loop processing from steps S27 to S35 is performed forevery ranging area. First, it is determined whether or not degree ofcoincidence computation value>threshold value (S29). Here, the CPU 30 adetermines whether or not a degree of coincidence computation value thatwas calculated in step S7 is larger than a threshold value, for everyranging area.

If the result of determination in step S29 is that the degree ofcoincidence computation value is larger than the threshold value, it isdetermined that reliability of AF computation result is low, and thatnumber of AF computation results for which reliability is low is countedas exclusions (S31). As was described previously, degree of coincidenceof image pixel data (pixel data after interpolation by interpolationcomputation) represents reliability of correlation calculation resultfor the purpose of phase difference AF. If the degree of coincidencecomputation value is larger than the threshold value, it is judged thatreliability of the correlation calculation value for that ranging areais low, and counted as an exemption when determining AF ranging area.

On the other hand, if the result of determination in step S29 is thatthe degree of coincidence computation value is lower than the thresholdvalue, counting is not performed (S33). Here, differing from step S31,it is determined that reliability of the correlation calculation valueof that ranging area is high, and it is not made a count target.

If the processing of step S31 or S33 has been executed, it is nextdetermined whether or not the loop has been completed (S35). Heredetermination is based on whether the processing of steps S29 to S33 hasbeen performed for ranging areas. If processing has not been performedfor all ranging areas, processing is performed for the next ranging areain accordance with the specified sequence.

If the result of determination in step S35 is that the loop has beencompleted, it is next determined whether or not a number of rangingresults >exclusion count number (S37). Here it is determined whether ornot a number of ranging areas (number of ranging results) is larger thana number that was counted in step S33.

If the result of determination in step S37 is that the number of rangingareas (number of ranging results) is larger than a number that wascounted in step S33, data that was counted as exclusions is excludedfrom data of the ranging results (S39). Here, since a correlationcalculation value for a ranging area in which degree of coincidencecomputation value that was calculated in step S7 is larger than athreshold value has low reliability, it is determined that the rangingresult values (correlation calculation value, defocus amount) for thatranging area will be excluded when calculating (determining) defocusamount of the focus lens.

On the other hand, in a case where the result of determination in stepS37 is that the number of ranging areas (number of ranging results) islarger than a number that was counted in step S33 (that is, in a casewhere the number of ranging areas and the count value match), or if theresult of determination in step S23 is that data that can be utilized inAF computation results is 1 or 0, nothing is done (S41). Here,processing such as to exclude data from the ranging results, such as wasperformed in step S39, is not performed. If the processing of steps S39or S41 has been performed, the originating processing flow is returnedto.

In this way, with this embodiment, phase difference pixel data isincluded in still read-out data, the degree of similarity S(i) shown inequation (1) is calculated using a standard signal within this phasedifference pixel data and a reference signal, and the value where thisS(i) becomes a minimum value is obtained (S3). There is a possibility ofusing this value as a ranging result in in-focus determination.

On the other hand, light shielding members (mask members) forrestricting to only light flux that has passed through pupil regions areprovided on image pixels (for example, green pixels). As a result, thereis no change in relative exposure amount, such as is seen with L pixelsand R pixels, even if position of the photographing lens (optical systemlens) 2 changes. Accordingly, conditions under which relative exposureamount at image pixels changes are not dependent on defocus amount ofthe photographing lens 2, but are affected by only image, such as of apixel size level high-frequency subject, periodicity-containing subjectetc.

In a case where relative exposure amount has an effect on image pixels,it will also have an effect on phase difference pixels. Therefore, whencalculating degree of similarity S(i), which is equivalent to degree ofcoincidence, using image pixel data, calculation of defocus amount usinghigh reliability data is possible, by excluding ranging data for whichthis degree of similarity S(i) is larger than a threshold value. Ifdegree of coincidence (S(i) that has been calculated using equation (1)described above) that has been calculated using

Bayer data exceeds a specified threshold value, it can then bedetermined to be no good as data for ranging calculation (refer to S9)since an image (for example, a high-frequency subject orperiodicity-containing subject) that causes ranging error is containedin the standard signal and the reference signal from the beginning. Byremoving this ranging result of a ranging area that will be excluded itis possible to calculate defocus amount with only high reliability data.

In this way, in the flowcharts shown in FIG. 5 and FIG. 6, phasedifference is detected based on pixel data of paired phase differencepixels (S3), pixel data of virtual image pixels is calculated atpositions of the phase difference pixels (S5), degree of coincidence ofassociated pixel data of virtual image pixels that was calculated atpositions of the paired phase difference pixels is calculated (S7),reliability of the phase difference detection result is determined inaccordance with degree of coincidence (S9), and focus adjustment isperformed based on phase difference detection results and thereliability (S11).

As has been described above, with the one embodiment of the presentinvention, phase difference pixels that detect phase difference usingopenings that are paired left and right, upper and lower, or in someother way, are arranged on an image sensor (refer to FIG. 2A). Then,virtual image pixel output of positions where phase difference pixelsexist is calculated using interpolation computation and degree ofcoincidence of associated virtual image pixels of paired openings iscalculated (refer to S5 and S7 in FIG. 5), and reliability of detectionresults of defocus amount for image plane phase difference AF isdetermined using this degree of coincidence (refer to S9 in FIGS. 5 andS29 in FIG. 6). Degree of coincidence is calculated using a correlationoperation for virtual imaging pixel output, and degree of coincidence isdetermined to be high as the result of that calculation approaches zero(refer to S7 in FIGS. 5 and S29 in FIG. 6). Virtual image pixel data isobtained by interpolation computation etc. using image pixel data aroundphase difference pixels positions. This means that with this embodimentit is possible to suppress variations in ranging that arise because ofseparation of arrangement positions of phase difference pixels. It isalso possible to exclude erroneous ranging data by utilizing virtualimage pixel data of phase difference pixels, and it is possible toperform high precision focus detection.

In a case where light shielded type phase difference pixels are arrangedon the image plane of the image sensor, in order to ensure image qualityof a taken image, pixel data for positions of phase difference pixels isinterpolated using surrounding image pixel data, to give a taken image.In order to avoid problems with this interpolation computation,positions of pairs of phase difference pixels are set apart. Becausepaired difference pixel positions are different, in a case of a highfrequency subject pattern close to the pixel pitch, ranging errors willarise because image forming light that is irradiated on pairs of phasedifference pixels is different and the pixel data of the pairs of phasedifference pixels is different, and AF precision is lowered. However, aswas described above, with this embodiment reliability of ranging resultsusing phase difference AF is determined based on degree of coincidenceof output of pairs of virtual image pixels and ranging results of lowreliability are removed, which means that it becomes possible to performhigh precision focus detection.

It should be noted that with the one embodiment of the present inventionvirtual image pixel data for positions of phase difference pixels wascalculated in steps S5 and S7, and reliability of ranging data usingimage plane phase difference AF was determined by calculating degree ofcoincidence of paired virtual image pixel data. However, calculation ofdegree of coincidence using paired virtual image pixel data may becalculation that includes degree of coincidence of other image pixeldata, and reliability of ranging data may be determined using imageplane phase difference AF.

Also, image pixel data having the same color filter positioned aroundphase difference pixels may be selected, and reliability determined bycalculating degree of coincidence of associated image pixel data thathas been selected. For example, degree of coincidence may also becalculated for image pixel data of red pixels 4R_RE1, 4R_RE2 . . .adjacent to the R pixels in FIG. 7 and image pixel data of red pixels4L_RE1, 4L_RE2 . . . adjacent to the L pixels. A degree of coincidencecalculation method and a reliability determination method may be thesame as the methods that used virtual image pixel data. Also, degree ofcoincidence may be calculated for image pixel data of blue pixels 4R_B1(4RB2 . . . ) adjacent to R pixels in FIG. 7 and image pixel data ofblue pixels 4L_B1 (4LB2 . . . ) adjacent to L pixels. In a case where aplurality of blue (red) pixels exist adjacent to R pixels and L pixels,degree of coincidence may also be calculated by selecting blue (red)pixels having the same positional relationship as the R pixels and Lpixels, and degree of coincidence may also be obtained using values(average values) resulting from having added image pixel data of theplurality of adjacent blue (red) pixels.

Also, degree of coincidence of image pixel data of green pixels 4R_G1that are positioned in the vicinity of the R pixels of FIG. 7 and greenpixels 4L_G1 that are positioned in the vicinity of the L pixels may becalculated, and degree of coincidence of image pixel data of greenpixels 4R_G1′ and 4L_G′1 that are between respective arrangementpositions of the R pixels and L pixels may also be calculated. Further,reliability may be determined by obtaining a final degree of coincidence(degree of coincidence computation value) by subjecting all or some of aplurality of degrees of coincidence (degree of coincidence computationvalues), namely degree of coincidence of red pixels 4R_RE1 and 4L_RE1,degree of coincidence of blue pixels 4R_B1 and 4L_B1, and degree ofcoincidence of green pixels 4R_G1, and 4L_G1 to averaging processing orweighted averaging.

Also, with the one embodiment of the present invention, it wasdetermined that reliability is low if degree of coincidence computationvalue is higher than a threshold value (refer to S29 and S31 in FIG. 6).However, this is not limiting, and a computation equation for degree ofcoincidence calculation may also be used such that reliability isdetermined to be high if degree of coincidence computation value ishigher than a threshold value.

Also, with the one embodiment of the present invention, there arecircuits such as the image processing circuit 30 b and the phasedifference detection circuit 30 c within the system controller 30, butinstead of hardware circuits they may also be configured as softwareusing a CPU and programs, may be implemented by hardware circuits suchas gate circuits that are generated based on a programming languagedescribed using Verilog, or may be configured using a DSP (DigitalSignal Processor). This also applies to each circuit section of aprocessor consisting of an integrated circuit such as an FPGA (FieldProgrammable Gate Array). Alternatively, a plurality of processorshaving one or more CPUs may also be arranged in a distributed manner.

Also, with the one embodiment of the present invention, the clockcircuit 8, monitor drive circuit 24 etc. have been constructedseparately from the system controller 30, but some or all of thesesections may be constructed using software, and executed by the systemcontroller 30. These circuits may also be arranged within the systemcontroller 30.

Also, with this embodiment, an instrument for taking pictures has beendescribed using a digital camera, but as a camera it is also possible touse a digital single lens reflex camera or a compact digital camera, ora camera for movie use such as a video camera, and further to have acamera that is incorporated into a mobile phone, a smartphone, a mobileinformation terminal, personal computer (PC), tablet type computer, gameconsole etc., a medical camera, or a camera for a scientific instrumentsuch as a microscope, a camera for mounting on a vehicle, a surveillancecamera etc. The present invention may be applied to an endoscope, as amedical camera. In the case of observing taking enlarged pictures withhigh magnification factor, such as a microscope for operations, it isprobable that there will be images of blood capillaries having a highfrequency pattern or inclined pattern. By applying this application, itis possible to perform high precision focus detection and AF even for asubject that contains blood capillaries. In any event, it is possible toadopt the present invention as long as a device carries out focusdetection using image plane phase difference AF.

Also, among the technology that has been described in thisspecification, with respect to control that has been described mainlyusing flowcharts, there are many instances where setting is possibleusing programs, and such programs may be held in a storage medium orstorage section. The manner of storing the programs in the storagemedium or storage section may be to store at the time of manufacture, orby using a distributed storage medium, or they be downloaded via theInternet.

Also, with the one embodiment of the present invention, operation ofthis embodiment was described using flowcharts, but procedures and ordermay be changed, some steps may be omitted, steps may be added, andfurther the specific processing content within each step may be altered.It is also possible to suitably combine structural elements fromdifferent embodiments.

Also, regarding the operation flow in the patent claims, thespecification and the drawings, for the sake of convenience descriptionhas been given using words representing sequence, such as “first” and“next”, but at places where it is not particularly described, this doesnot mean that implementation must be in this order.

As understood by those having ordinary skill in the art, as used in thisapplication, ‘section,’ ‘unit,’ ‘component,’ ‘element,’ ‘module,’‘device,’ ‘member,’ ‘mechanism,’ ‘apparatus,’ ‘machine,’ or ‘system’ maybe implemented as circuitry, such as integrated circuits, applicationspecific circuits (“ASICs”), field programmable logic arrays (“FPLAs”),etc., and/or software implemented on a processor, such as amicroprocessor.

The present invention is not limited to these embodiments, andstructural elements may be modified in actual implementation within thescope of the gist of the embodiments. It is also possible form variousinventions by suitably combining the plurality structural elementsdisclosed in the above described embodiments. For example, it ispossible to omit some of the structural elements shown in theembodiments. It is also possible to suitably combine structural elementsfrom different embodiments.

What is claimed is:
 1. An imaging device, comprising: an image sensor having imaging pixels that receive light of a subject image though a photographing lens and perform photoelectric conversion, and paired phase difference pixels that respectively receive light flux corresponding to pupil regions that are paired with the photographing lens and perform photoelectric conversion on the light flux that has been received; and a processor having a phase difference detection section, pixel data calculation section, degree of coincidence calculation section, reliability determination section, and focus adjustment section, wherein the phase difference detection section detects a phase difference based on pixel data of the paired phase difference pixels; the pixel data calculation section calculates pixel data of virtual image pixels at positions of the phase difference pixels, or selects pixel data of image pixels around positions of the phase difference pixels; the degree of coincidence calculation section calculates degree of coincidence between each pixel data of the virtual image pixels that have been calculated, or calculates degree of coincidence of each pixel data of image pixels that have been selected for positions of paired phase difference pixels; the reliability determination section determines reliability of the phase difference detection result in accordance with the degree of coincidence; and the focus adjustment section performs focus adjustment based on the phase difference detection result and the reliability.
 2. The imaging device of claim 1, wherein: the reliability determination section determines that reliability is low if the degree of coincidence is lower than a threshold value, and the phase difference detection section detects phase difference by excluding pixel data of the phase difference pixels for which it has been determined that the reliability is low.
 3. The imaging device of claim 1, wherein: the pixel data calculation section comprises: a gain setting section that sets gain for pixel data of the phase difference pixels, and an interpolation section that interpolates pixel data of virtual imaging pixels corresponding to position of the phase difference pixels, based on pixel data of imaging pixels positioned around the phase difference pixels, wherein, the pixel data calculation section calculates pixel data of virtual imaging pixels corresponding to positions of the phase difference pixels based on a value resulting from having applied the gain to pixel data of the phase difference pixels, and the pixel data that has been interpolated.
 4. The imaging device of claim 1, wherein: the phase difference detection section detects phase difference for every ranging area; the degree of coincidence calculation section calculates degree of coincidence for every ranging area; the reliability determination section determines reliability for every ranging area; and the focus adjustment section determines a ranging area for calculating defocus amount of the photographing lens by excluding ranging results for ranging areas of low reliability based on the reliability that has been determined for each ranging area.
 5. The imaging device of claim 1, wherein: the image sensor has a color filter for every pixel, and the degree of coincidence calculation section calculates degree of coincidence based on pixel data of image pixels that have the same color filter.
 6. The imaging device of claim 5, wherein: the degree of coincidence calculation section calculates respective degrees of coincidence of associated pixel data of image pixels that have different color filters, and the reliability determination section determines reliability based on a plurality of degrees of coincidence corresponding to the different color filters.
 7. The imaging device of claim 5, wherein: the degree of coincidence calculation section calculates respective degrees of coincidence of associated pixel data of a plurality of image pixels that have the same color filter, and the reliability determination section determines reliability based on a plurality of degrees of coincidence for each of the plurality of color filters of the same color.
 8. A focus adjustment method, for an imaging device provided with an image sensor having imaging pixels that receive light of a subject image though a photographing lens and perform photoelectric conversion, and paired phase difference pixels that respectively receive light flux corresponding to pupil regions that are paired with the photographing lens and perform photoelectric conversion on the light flux that has been received, comprising: detecting a phase difference based on pixel data of the paired phase difference pixels; calculating pixel data of virtual image pixels at positions of the phase difference pixels, or selecting pixel data of image pixels around positions of the phase difference pixels; calculating degree of coincidence between each pixel data of the virtual image pixels that have been calculated, or calculating degree of coincidence of each pixel data of image pixels that have been selected for positions of paired phase difference pixels; determining reliability of the phase difference detection result in accordance with the degree of coincidence; and performing focus adjustment based on the phase difference detection result and the reliability.
 9. The focus adjustment method of claim 8, further comprising: determining that reliability is low if the degree of coincidence is lower than a threshold value, and detecting phase difference by excluding pixel data of the phase difference pixels for which it has been determined that the reliability is low.
 10. The focus adjustment method of claim 8, further comprising: at the time of the pixel data calculation, setting gain for pixel data of the phase difference pixels; interpolating pixel data of virtual imaging pixels corresponding to position of the phase difference pixels, based on pixel data of imaging pixels positioned around the phase difference pixels; and calculating pixel data of virtual imaging pixels corresponding to positions of the phase difference pixels based on a value resulting from having applied the gain to pixel data of the phase difference pixels, and the pixel data that has been interpolated.
 11. The focus adjustment method of claim 8, further comprising: detecting phase difference for every ranging area; calculating degree of coincidence for every ranging area; determining reliability for every ranging area; and determining a ranging area for calculating defocus amount of the photographing lens by excluding ranging results for ranging areas of low reliability based on the reliability that has been determined for each ranging area.
 12. The focus adjustment method of claim 8, wherein: the image sensor has a color filter for every pixel, and further comprising, calculating degree of coincidence based on pixel data of image pixels that have the same color filter.
 13. The focus adjustment method of claim 12, further comprising: calculating respective degrees of coincidence of associated pixel data of image pixels that have different color filters; and determining reliability based on a plurality of degrees of coincidence corresponding to the different color filters.
 14. The focus adjustment method of claim 12, further comprising: calculating respective degrees of coincidence of associated pixel data of image pixels that have a plurality of the same color filters; and determining reliability based on a plurality of degrees of coincidence for each of the plurality of color filters of the same color.
 15. A non-transitory computer-readable medium , storing a processor executable code, which when executed by at least one processor, the processor being provided within an imaging device provided with an image sensor having imaging pixels that receive light of a subject image though a photographing lens and perform photoelectric conversion, and paired phase difference pixels that respectively receive light flux corresponding to pupil regions that are paired with the photographing lens and perform photoelectric conversion on the light flux that has been received, performs a focus adjusting method, the focus adjusting method comprising: detecting a phase difference based on pixel data of the paired phase difference pixels; calculating pixel data of virtual image pixels at positions of the phase difference pixels, or selecting pixel data of image pixels around positions of the phase difference pixels; calculating degree of coincidence between each pixel data of the virtual image pixels that have been calculated, or calculating degree of coincidence of each pixel data of image pixels that have been selected for positions of paired phase difference pixels; determining reliability of the phase difference detection result in accordance with the degree of coincidence; and performing focus adjustment based on the phase difference detection result and the reliability.
 16. The non-transitory computer-readable medium of claim 15, storing further processor executable code, which when executed by the at least one processor, causes the at least one processor to perform a method further comprising: determining that reliability is low if the degree of coincidence is lower than a threshold value; and detecting phase difference by excluding pixel data of the phase difference pixels for which it has been determined that the reliability is low.
 17. The non-transitory computer-readable medium of claim 15, storing further processor executable code, which when executed by the at least one processor, causes the at least one processor to perform a method further comprising: at the time of the pixel data calculation, setting gain for pixel data of the phase difference pixels; interpolating pixel data of virtual imaging pixels corresponding to position of the phase difference pixels, based on pixel data of imaging pixels positioned around the phase difference pixels; and calculating pixel data of virtual imaging pixels corresponding to positions of the phase difference pixels based on a value resulting from having applied the gain to pixel data of the phase difference pixels, and the pixel data that has been interpolated.
 18. The non-transitory computer-readable medium of claim 15, storing further processor executable code, which when executed by the at least one processor, causes the at least one processor to perform a method further comprising: detecting phase difference for every ranging area; calculating degree of coincidence for every ranging area; determining reliability for every ranging area; and determining a ranging area for calculating defocus amount of the photographing lens by excluding ranging results for ranging areas of low reliability based on the reliability that has been determined for each ranging area.
 19. The non-transitory computer-readable medium of claim 15, storing further processor executable code, which when executed by the at least one processor, causes the at least one processor to perform a method further comprising: the image sensor has a color filter for every pixel, and further comprising, calculating respective degrees of coincidence based on pixel data of image pixels that have the same color filter.
 20. The non-transitory computer-readable medium of claim 19, storing further processor executable code, which when executed by the at least one processor, causes the at least one processor to perform a method further comprising: calculating respective degrees of coincidence of associated pixel data of image pixels that have different color filters; and determining reliability based on a plurality of degrees of coincidence corresponding to the different color filters. 